package com.own.component.common.login.util;

import com.own.component.common.login.function.LoginInfoFunction;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.UUID;

/**
 * LoginInfoUtil
 *
 * @author chenxueli
 * @date 2023-08-08 16:45:00
 */
@Component
public class LoginInfoUtil {

    private static final String LOGIN_ACCOUNT_KEY = UUID.randomUUID() + "login_account";
    private static final String LOGIN_TYPE_KEY = UUID.randomUUID() + "login_type";
    private static final String LOGIN_CODE_KEY = UUID.randomUUID() + "login_code";

    @Resource
    private HttpServletRequest request;

    /**
     * 登录类型信息
     *
     * @return 登录类型信息
     */
    public LoginInfoFunction type() {
        return new LoginInfoFunction(request, LOGIN_TYPE_KEY);
    }

    /**
     * 登录账号信息
     *
     * @return 请求类型信息
     */
    public LoginInfoFunction account() {
        return new LoginInfoFunction(request, LOGIN_ACCOUNT_KEY);
    }


    /**
     * 登录密码信息
     *
     * @return 登录密码信息
     */
    public LoginInfoFunction code() {
        return new LoginInfoFunction(request, LOGIN_CODE_KEY);
    }

}
